package cn.com.cfae.iras.doc.analyze.parse.extractor;

import cn.com.cfae.iras.doc.analyze.keys.ExtractMethod;
import cn.com.cfae.iras.doc.analyze.parse.kv.KVText;
import cn.com.cfae.iras.doc.analyze.parse.kv.TextLayout;
import cn.com.cfae.iras.doc.analyze.parse.model.*;
import cn.com.cfae.iras.doc.analyze.parse.tokenizer.*;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * M5发行人基本信息
 */
public class M5Extractor extends MTableExtractor {
    private static final Logger logger = LoggerFactory.getLogger(M5Extractor.class);
    private FXRTokenizer fxrTokenizer = FXRTokenizer.getInstance();
    private HDTokenizer hdTokenizer = HDTokenizer.getInstance();
    private MTTokenizer mtTokenizer = MTTokenizer.getInstance();
    private GSGLTokenizer gsglTokenizer = GSGLTokenizer.getInstance();
    private FDCTokenizer fdcTokenizer = FDCTokenizer.getInstance();
    private SNTokenizer snTokenizer = SNTokenizer.getInstance();
    private GTTokenizer gtTokenizer = GTTokenizer.getInstance();
    private DJGTokenizer djgTokenizer = DJGTokenizer.getInstance();
    private YWGGCTokenizer ywggcTokenizer = YWGGCTokenizer.getInstance();
    private ZJGCTokenizer zjgcTokenizer = ZJGCTokenizer.getInstance();

    @Override
    public void extract() {
        try {
            try {
                parseChapterSection();
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
            try {
                extractM5();
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
            try {
                extractIndustryIndicators();
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
    }

    /**
     * 抽取M5
     */
    private void extractM5() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取：{}章节业务模型数据，表格类型：{}......", getChapterModel().getChapterId(), getDocumentModel().getTableType());

        try {
            extractM5Fxr();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            extractM5DjgTable();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            extractM5Dsh();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            extractM5Jsh();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            extractM5Gg();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            extractM5Yysr();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            extractM5Yycb();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            extractM5Mlr();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            extractM5Mll();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            extractM5Zjgc();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try {
            extractM5Ywggc();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        long t2 = System.currentTimeMillis();
        logger.info("抽取：{}章节业务模型数据完成，表格类型：{}，耗时：{}毫秒。", getChapterModel().getChapterId(), getDocumentModel().getTableType(), (t2 - t1));
    }

    private void extractM5Dsh() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取{}章董事会业务模型数据......", getChapterModel().getChapterId());
        ExtractBizModel extractBizModel = getExtractBizModel("DSH");
        ExtractItem extractItem = extractBizModel.getExtractItem("DSH");
        djgTokenizer.loadCoreSynonyms(extractBizModel);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        if (CollectionUtils.isEmpty(sectionModelList)) {
            logger.error("抽取{}章董事会业务模型数据，分析列表为空，请确认！！！", getChapterModel().getChapterId());
            return;
        }
        try {
            for (int i = 0; i < sectionModelList.size(); i++) {
                SectionModel sectionModel = sectionModelList.get(i);
                List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
                if (CollectionUtils.isEmpty(childSectionModelList)) {
                    continue;
                }
                for (int j = 0; j < childSectionModelList.size(); j++) {
                    SectionModel childSectionModel = childSectionModelList.get(j);
                    String content = childSectionModel.getContent();
                    if (isEmpty(content)) {
                        continue;
                    }
                    logger.info("抽取{}章董事会业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractBizModel.getModelName(), childSectionModel.getTitle());
                    djgTokenizer.extractDSH(extractItem, content);
                    if (extractItem.getKey() != null && extractItem.getValue() != null) {
                        break;
                    }
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        djgTokenizer.unloadCoreSynonyms(extractBizModel);
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章董事会业务模型数据，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }

    private void extractM5Gg() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取{}章高管业务模型数据......", getChapterModel().getChapterId());
        ExtractBizModel extractBizModel = getChapterModel().getModel("GG");
        ExtractItem extractItem = extractBizModel.getExtractItem("GG");
        djgTokenizer.loadCoreSynonyms(extractBizModel);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        if (CollectionUtils.isEmpty(sectionModelList)) {
            logger.error("抽取{}章高管业务模型数据，分析列表为空，请确认！！！", getChapterModel().getChapterId());
            return;
        }
        try {
            for (int i = 0; i < sectionModelList.size(); i++) {
                SectionModel sectionModel = sectionModelList.get(i);
                List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
                if (CollectionUtils.isEmpty(childSectionModelList)) {
                    continue;
                }
                for (int j = 0; j < childSectionModelList.size(); j++) {
                    SectionModel childSectionModel = childSectionModelList.get(j);
                    String content = childSectionModel.getContent();
                    if (isEmpty(content)) {
                        continue;
                    }
                    logger.info("抽取{}章高管业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractBizModel.getModelName(), childSectionModel.getTitle());
                    djgTokenizer.extractGG(extractItem, content);
                    if (extractItem.getKey() != null && extractItem.getValue() != null) {
                        break;
                    }
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        djgTokenizer.unloadCoreSynonyms(extractBizModel);
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章高管业务模型数据，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }

    private void extractM5Jsh() {
        long t1 = System.currentTimeMillis();
        logger.info("抽取{}章监事会业务模型数据......", getChapterModel().getChapterId());
        ExtractBizModel extractBizModel = getChapterModel().getModel("JSH");
        ExtractItem extractItem = extractBizModel.getExtractItem("JSH");
        djgTokenizer.loadCoreSynonyms(extractBizModel);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        if (CollectionUtils.isEmpty(sectionModelList)) {
            logger.error("抽取{}章监事会业务模型数据，分析列表为空，请确认！！！", getChapterModel().getChapterId());
            return;
        }
        try {
            for (int i = 0; i < sectionModelList.size(); i++) {
                SectionModel sectionModel = sectionModelList.get(i);
                List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
                if (CollectionUtils.isEmpty(childSectionModelList)) {
                    continue;
                }
                for (int j = 0; j < childSectionModelList.size(); j++) {
                    SectionModel childSectionModel = childSectionModelList.get(j);
                    String content = childSectionModel.getContent();
                    if (isEmpty(content)) {
                        continue;
                    }
                    logger.info("抽取{}章监事会业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractBizModel.getModelName(), childSectionModel.getTitle());
                    djgTokenizer.extractJSH(extractItem, content);
                    if (extractItem.getKey() != null && extractItem.getValue() != null) {
                        break;
                    }
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        djgTokenizer.unloadCoreSynonyms(extractBizModel);
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章监事会业务模型数据，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }

    /**
     * 抽取M5发行人基本信息
     */
    public void extractM5Fxr() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取{}章发行人基本信息......", getChapterModel().getChapterId());
        PageModel pageModel = getPageModelList().get(0);
        ExtractBizModel extractBizModel = getChapterModel().getModel(FXRModel.MODEL_NAME);
        ExtractMethod[] extractMethods = extractBizModel.getExtractMethods();
        fxrTokenizer.loadCoreSynonyms(extractBizModel);
        boolean isFxr_End = false;
        logger.info("抽取{}章发行人基本信息，当前页码：{}，数据内容：{}。", getChapterModel().getChapterId(), pageModel.getPageNumber(), pageModel.getJsonTextData());
        if (pageModel != null) {
            List<String> extractTableDataList = null;
            ExtractMethod extractMethod = extractMethods[0];
            ExtractItem targetExtractItem = null;
            switch (extractMethod) {
                case TEXT:
                    break;
                case KV:
                    try {
                        extractTableDataList = extractPdfByTable(new String[]{getDocumentModel().getPdfFilePath(), "-l", "-p", String.valueOf(pageModel.getPageNumber()), "-a", pageModel.getDefaultPageArea().getLayout(), "-f", "JSON"});
                    } catch (Exception e) {
                        logger.error(e.getMessage(), e);
                    }
                    if (CollectionUtils.isEmpty(extractTableDataList)) {
                        logger.info("抽取{}章发行人基本信息，数据格式为文本形式，适用默认文本值进行分析，文本内容：{}。", getChapterModel().getChapterId(), pageModel.getJsonTextData());
                        JsonArray dataArray = getPageDataArray(pageModel);
                        for (int j = 0; j < dataArray.size(); j++) {
                            JsonArray lineArray = dataArray.get(j).getAsJsonArray();
                            String combineLine = combineTextJsonArray(lineArray);
                            if (isEmpty(combineLine)) {
                                continue;
                            }
                            if (isProspectus(combineLine)) {
                                continue;
                            }
                            if (isFXR_END(combineLine)) {
                                break;
                            }
                            logger.info("抽取{}章发行人基本信息，分析文本：{}。", getChapterModel().getChapterId(), combineLine);
                            double left = lineArray.get(0).getAsJsonObject().get("left").getAsDouble();
//                            if (pageModel.getWidth() / 4 > left && left > 0) {
                            if (isFXR_Format(combineLine)) {
                                targetExtractItem = fxrTokenizer.splitWords(extractBizModel, combineLine.split(findFXR_Format_Split_Char(combineLine))[0]);
                                try {
                                    if (targetExtractItem != null) {
                                        if (isFXR_Format(combineLine)) {
                                            setFXR_KV(lineArray, targetExtractItem);
                                            setExtractItemPageNumber(pageModel, targetExtractItem);
                                            logger.info("抽取{}章发行人基本信息，分析到发行条款相关信息，EXTRACTITEM：{}，KEY：{}，VALUE：{}。", getChapterModel().getChapterId(), targetExtractItem.getItemName(), targetExtractItem.getKey().getText(), targetExtractItem.getValue().getText());
                                            continue;
                                        }
                                    }
                                } catch (Exception e) {
                                    logger.error(e.getMessage(), e);
                                }
                            }
                        }
                    } else {
                        logger.info("抽取{}章发行人基本信息,数据格式为表格形式，表格内容：{}。", getChapterModel().getChapterId(), extractTableDataList);
                        logger.info("抽取{}章发行人基本信息,该页码含误导信息，实际数据格式为文本形式，适用默认文本值进行分析，获取文本值：{}。", getChapterModel().getChapterId(), pageModel.getJsonTextData());
                        JsonElement tableData = str2Json(extractTableDataList.get(0));
                        JsonObject jsonObject = tableData.getAsJsonArray().get(0).getAsJsonObject();
                        JsonArray dataArray = jsonObject.get("data").getAsJsonArray();
                        double top = jsonObject.get("top").getAsDouble();
                        if (dataArray.size() <= 3 || pageModel.getHeight() / 2 < top) {
                            logger.info("抽取{}章发行人基本信息,执行到该处应该为发行条款首页，该页码含误导信息，实际数据格式有可能为文本形式，适用默认文本值进行分析，获取文本值：{}。", getChapterModel().getChapterId(), pageModel.getJsonTextData());
                            JsonElement pageTextData = pageModel.getJsonTextData();
                            jsonObject = pageTextData.getAsJsonArray().get(0).getAsJsonObject();
                            dataArray = jsonObject.get("data").getAsJsonArray();
                            for (int j = 0; j < dataArray.size(); j++) {
                                JsonArray lineArray = dataArray.get(j).getAsJsonArray();
                                String combineLine = combineTextJsonArray(lineArray);
                                if (isEmpty(combineLine)) {
                                    continue;
                                }
                                if (isProspectus(combineLine)) {
                                    continue;
                                }
                                if (isFXR_END(combineLine)) {
                                    break;
                                }
                                logger.info("抽取{}章发行人基本信息，分析文本：{}。", getChapterModel().getChapterId(), combineLine);
                                double left = lineArray.get(0).getAsJsonObject().get("left").getAsDouble();
//                                if (pageModel.getWidth() / 5 > left && left > 0) {
                                if (isFXR_Format(combineLine)) {
                                    String key = combineLine.split(findFXR_Format_Split_Char(combineLine))[0];
                                    targetExtractItem = fxrTokenizer.splitWords(extractBizModel, replaceSpaces(key));
                                    try {
                                        if (targetExtractItem != null) {
                                            if (isFXR_Format(combineLine)) {
                                                setFXR_KV(lineArray, targetExtractItem);
                                                setExtractItemPageNumber(pageModel, targetExtractItem);
                                                logger.info("抽取{}章发行人基本信息，分析到发行人相关信息，EXTRACTITEM：{}，KEY：{}，VALUE：{}。", getChapterModel().getChapterId(), targetExtractItem.getItemName(), targetExtractItem.getKey().getText(), targetExtractItem.getValue().getText());
                                                continue;
                                            }
                                        }
                                    } catch (Exception e) {
                                        logger.error(e.getMessage(), e);
                                    }
                                }
                            }
                        } else {
                            for (int k = 0; k < dataArray.size(); k++) {
                                int offset = 0;
                                JsonArray itemArray = dataArray.get(k).getAsJsonArray();
                                List<JsonObject>validJsonObjectList = findValidTableCells(itemArray);
                                if(validJsonObjectList.isEmpty()){
                                    continue;
                                }
                                JsonObject keyJsonObject = validJsonObjectList.get(0);
                                String key = keyJsonObject.get("text").getAsString().trim();
                                if (NumberUtils.isDigits(key)) {
                                    logger.info("抽取{}章发行人基本信息，该列可能为序号，获取下一列，后续改为动态判断。", getChapterModel().getChapterId(), key);
                                    offset = 1;
                                    key = validJsonObjectList.get(offset).getAsJsonObject().get("text").getAsString().trim();
                                }
                                String value = itemArray.get(itemArray.size() - 1).getAsJsonObject().get("text").getAsString();
                                logger.info("抽取{}章发行人基本信息,分析表格数据内容，第{}条，KEY：{}，VALUE：{}。", getChapterModel().getChapterId(), (k + 1), key, value);
                                targetExtractItem = fxrTokenizer.splitWords(extractBizModel, replaceCRLF(key));
                                if (targetExtractItem != null) {
                                    setFXR_Table_KV(validJsonObjectList, offset, targetExtractItem, pageModel);
                                    setExtractItemPageNumber(pageModel, targetExtractItem);
                                    logger.info("抽取{}章发行人基本信息,分析到发行人相关信息，EXTRACTITEM：{}，KEY：{}，VALUE：{}。", getChapterModel().getChapterId(), targetExtractItem.getItemName(), key, value);
                                    continue;
                                }
                            }
                        }
                    }
                    break;
                case TABLE:
                    break;
                case DEFAULT:
                    break;
            }
        } else {
            logger.error("抽取{}章发行人基本信息，当前页码：{}，PDF文档：{}，不存在，请检查！", getChapterModel().getChapterId(), pageModel.getPageNumber(), getDocumentModel().getPdfFilePath());
        }
        fxrTokenizer.unloadCoreSynonyms(extractBizModel);
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章发行人基本信息完成，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }

    /**
     * 董监高-表格数据
     */
    private void extractM5DjgTable() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取：{}章董监高业务模型数据......", getChapterModel().getChapterId());
        List<PageModel> pageModelList = getPageModelList();
        PageModel pageModel = null;
        List<PageArea> pageAreaList = new ArrayList<>();
        TextLayout startTextLayout = null;
        TextLayout endTextLayout = null;
        for (int i = 0; i < pageModelList.size(); i++) {
            pageModel = pageModelList.get(i);
            if (pageModel == null) {
                continue;
            }
            JsonArray itemArray = getPageDataArray(pageModel);
            for (int j = 0; j < itemArray.size(); j++) {
                JsonArray items = itemArray.get(j).getAsJsonArray();
                String combineLine = combineTextJsonArray(items);
                if (isEmpty(combineLine)) {
                    continue;
                }
                if (isProspectus(combineLine)) {
                    continue;
                }
                if (j == (itemArray.size() - 1)) {
                    if (getPageModelBottomPageNum(items) > 0) {
                        logger.info("抽取：{}章董监高业务模型，当前页码：{}，已到该页末尾，到下一页定位董监高信息表结束位置。", getChapterModel().getChapterId(), pageModel.getPageNumber());
                        break;
                    }
                }
                if (isDJG(combineLine)) {
                    logger.info("抽取：{}章董监高业务模型数据，开始页码：{}，分析定位到董监高表格位置......，表头：{}。", getChapterModel().getChapterId(), combineLine);
                    if (startTextLayout != null) {
                        endTextLayout = createKVTextLayout(pageModel, items);
                        pageAreaList.addAll(createPageArea(startTextLayout, endTextLayout));
                        startTextLayout = null;
                        endTextLayout = null;
                    }
                    startTextLayout = createKVTextLayout(pageModel, items);
                    continue;
                }
                if (isInner3(items, pageModel)) {
                    continue;
                } else if (startTextLayout != null) {
                    if (isAmtUnit(combineLine)) {
                        continue;
                    }
                    endTextLayout = createKVTextLayout(pageModel, items);
                    logger.info("抽取：{}章董监高业务模型数据，分析定位到董监高表格结束位置，结束页码：{}。", getChapterModel().getChapterId(), combineLine);
                    pageAreaList.addAll(createPageArea(startTextLayout, endTextLayout));
                    startTextLayout = null;
                    endTextLayout = null;
                    if (isDJG(combineLine)) {
                        startTextLayout = createKVTextLayout(pageModel, items.get(0).getAsJsonObject());
                    }
                    continue;
                }
            }
        }
        if (CollectionUtils.isEmpty(pageAreaList)) {
            logger.info("抽取：{}章董监高业务模型，分析定位董监高表格位置失败。", getChapterModel().getChapterId());
            return;
        }
        logger.info("抽取：{}章董监高业务模型，董监高表格位置定位完成，开始抽取模型数据......", getChapterModel().getChapterId());
        ExtractBizModel extractBizModel = getChapterModel().getExtractBizModelMap().get("DJG");
        List<DJGIndex> previousDjgIndexList = new ArrayList<>();
        for (int i = 0; i < pageAreaList.size(); i++) {
            try {
                PageArea pageArea = pageAreaList.get(i);
                logger.info("抽取{}章董监高业务模型，当前页码：{}，表格区域：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageArea.getLayout());
                List<String> pageTableDataList = extractPdfByTable(new String[]{getDocumentModel().getPdfFilePath(), "-l", "-p", String.valueOf(pageArea.getPageNumber()), "-a", pageArea.getLayout(), "-f", "JSON"});
                logger.info("抽取{}章董监高业务模型，当前页码：{}，表格数量：{}，表格数据：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageTableDataList.size(), pageTableDataList);
                if (pageTableDataList.isEmpty()) {
                    continue;
                }
                String tableHeader = pageTableDataList.get(0);
                logger.info("抽取{}章董监高业务模型，董监高信息表表头信息：{}。", getChapterModel().getChapterId(), tableHeader);
                List<DJGIndex> djgIndexList = new ArrayList<>();
                int offset = 0;
                {
                    JsonArray pageData = str2Json(tableHeader).getAsJsonArray();
                    JsonObject tableData = pageData.get(0).getAsJsonObject();
                    JsonArray items = tableData.get("data").getAsJsonArray();
                    JsonArray itemArray = items.get(0).getAsJsonArray();
                    for (int j = 0; j < itemArray.size(); j++) {
                        JsonObject cell = itemArray.get(j).getAsJsonObject();
                        String text = replaceSpaces(cell.get("text").getAsString().trim());
                        if (isEmpty(text)) {
                            continue;
                        }
                        if (isDJG_XM(text)) {
                            djgIndexList.add(new DJGIndex("XM", Integer.valueOf(j)));
                        } else if (isDJG_ZW(text)) {
                            djgIndexList.add(new DJGIndex("ZW", Integer.valueOf(j)));
                        }
                    }
                }
                if (i == 0) {
                    if (djgIndexList.isEmpty()) {
                        continue;
                    } else {
                        offset = 1;
                        previousDjgIndexList.clear();
                        previousDjgIndexList.addAll(djgIndexList);
                    }
                } else {
                    if (djgIndexList.isEmpty()) {
                        djgIndexList.addAll(previousDjgIndexList);
                    } else {
                        offset = 1;
                        previousDjgIndexList.clear();
                        previousDjgIndexList.addAll(djgIndexList);
                    }
                }
                if (djgIndexList.isEmpty()) {
                    continue;
                }

                for (int l = 0; l < pageTableDataList.size(); l++) {
                    String tableData = pageTableDataList.get(l);
                    logger.info("抽取{}章董监高业务模型，表格数据：{}。", getChapterModel().getChapterId(), tableData);
                    JsonArray pageData = str2Json(tableData).getAsJsonArray();
                    JsonObject var1 = pageData.get(0).getAsJsonObject();
                    JsonArray var2 = var1.get("data").getAsJsonArray();
                    for (int j = 0; j < var2.size(); j++) {
                        if (j < offset) {
                            continue;
                        }
                        JsonArray var3 = var2.get(j).getAsJsonArray();
                        try {
                            Map<String, ExtractItem> items = new HashMap<>();
                            for (int k = 0; k < djgIndexList.size(); k++) {
                                logger.info("抽取{}章董监高业务模型，第{}页，第{}条数据，分析内容：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), j, var3.toString());
                                DJGIndex djgIndex = djgIndexList.get(k);
                                JsonElement jsonElement = var3.get(djgIndex.getIndex()).getAsJsonObject();
                                ExtractItem extractItem = extractBizModel.getExtractItem(djgIndex.getName());
                                ExtractItem newExtractItem = (ExtractItem) BeanUtils.cloneBean(extractItem);
                                setKV(newExtractItem, jsonElement, jsonElement);
                                newExtractItem.getValue().getTextLayout().setPageNumber(pageArea.getPageNumber());
                                items.put(newExtractItem.getItemName(), newExtractItem);
                                logger.info("抽取{}章董监高业务模型，解析董监高信息表指标，姓名、职务，数据内容：{}。", getChapterModel().getChapterId(), var3.toString());
                            }
                            extractBizModel.addTable3(items);
                        } catch (IllegalAccessException e) {
                            logger.error(e.getMessage(), e);
                        } catch (InstantiationException e) {
                            logger.error(e.getMessage(), e);
                        } catch (InvocationTargetException e) {
                            logger.error(e.getMessage(), e);
                        } catch (NoSuchMethodException e) {
                            logger.error(e.getMessage(), e);
                        }
                    }
                }
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
        logger.info("抽取{}章董监高业务模型数据，董监高信息表数据结构：{}。", getChapterModel().getChapterId(), obj2Json(extractBizModel));
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章董监高业务模型数据完成，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }

    /**
     * 营业收入
     */
    private void extractM5Yysr() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取：{}章营业收入业务模型......", getChapterModel().getChapterId());
        List<PageModel> pageModelList = getPageModelList();
        PageModel pageModel = null;
        List<PageArea> pageAreaList = new ArrayList<>();
        TextLayout startTextLayout = null;
        TextLayout endTextLayout = null;
        ExtractBizModel extractBizModel = getChapterModel().getExtractBizModelMap().get("YYSR");
        for (int i = 0; i < pageModelList.size(); i++) {
            pageModel = pageModelList.get(i);
            if (pageModel == null) {
                continue;
            }
            JsonArray itemArray = getPageDataArray(pageModel);
            for (int j = 0; j < itemArray.size(); j++) {
                JsonArray items = itemArray.get(j).getAsJsonArray();
                String combineLine = combineTextJsonArray(items);
                if (isEmpty(combineLine)) {
                    continue;
                }
                if (j == (itemArray.size() - 1)) {
                    if (getPageModelBottomPageNum(items) > 0) {
                        logger.info("抽取：{}章营业收入业务模型，当前页码：{}，已到该页末尾，到下一页定位营业收入信息表结束位置。", getChapterModel().getChapterId(), pageModel.getPageNumber());
                        break;
                    }
                }
                if (isYYSR(combineLine)) {
                    setTableNameTextLayout(pageModel, extractBizModel, items);
                    logger.info("抽取：{}章营业收入业务模型，开始页码：{}，分析定位营业收入表格位置......，表头：{}。", getChapterModel().getChapterId(), combineLine);
                    startTextLayout = createKVTextLayout(pageModel, items);
                    continue;
                }
                if (isInner3(items, pageModel)) {
                    continue;
                } else if (startTextLayout != null) {
                    if (isAmtUnit(combineLine)) {
                        setTableUnitType(extractBizModel, combineLine);
                        continue;
                    }
                    endTextLayout = createKVTextLayout(pageModel, items);
                    logger.info("抽取：{}章营业收入业务模型，分析定位到营业收入表格结束位置，结束页码：{}。", getChapterModel().getChapterId(), combineLine);
                    pageAreaList.addAll(createPageArea(startTextLayout, endTextLayout));
                    break;
//                    startTextLayout = null;
//                    endTextLayout = null;
//                    continue;
                }
            }
            if (startTextLayout != null && endTextLayout != null) {
                break;
            }
        }
        if (CollectionUtils.isEmpty(pageAreaList)) {
            logger.info("抽取：{}章营业收入业务模型，分析定位营业收入表格位置失败！！！", getChapterModel().getChapterId());
            return;
        }
        logger.info("抽取：{}章营业收入业务模型，营业收入表格位置定位完成，开始抽取模型数据......", getChapterModel().getChapterId());
        //业务板块
        ExtractItem ywbk = extractBizModel.getExtractItem("YWBK");
        //营业收入、金额
        ExtractItem yysr = extractBizModel.getExtractItem("YYSR");
        //占比
        ExtractItem zb = extractBizModel.getExtractItem("ZB");
        List<String> years = new ArrayList<>();
        for (int i = 0; i < pageAreaList.size(); i++) {
            try {
                PageArea pageArea = pageAreaList.get(i);
                logger.info("抽取{}章营业收入业务模型，当前页码：{}，坐标：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageArea.getLayout());
                List<String> pageTableDataList = extractPdfByTable(new String[]{getDocumentModel().getPdfFilePath(), "-l", "-p", String.valueOf(pageArea.getPageNumber()), "-a", pageArea.getLayout(), "-f", "JSON"});
                logger.info("抽取{}章营业收入业务模型，当前页码：{}，表格数量：{}，表格数据：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageTableDataList.size(), pageTableDataList);
                if (pageTableDataList.isEmpty()) {
                    continue;
                }
                String tableHeader = pageTableDataList.get(0);
                logger.info("抽取{}章营业收入业务模型，营业收入表表头信息：{}。", getChapterModel().getChapterId(), tableHeader);
                if (i <= 1) {
                    JsonArray pageData = str2Json(tableHeader).getAsJsonArray();
                    JsonObject tableData = pageData.get(0).getAsJsonObject();
                    JsonArray items = tableData.get("data").getAsJsonArray();
                    JsonArray itemArray = items.get(0).getAsJsonArray();
                    for (int j = 0; j < itemArray.size(); j++) {
                        JsonObject cell = itemArray.get(j).getAsJsonObject();
                        String text = cell.get("text").getAsString();
                        String year = null;
                        if (isEmpty(text)) {
                            continue;
                        }
                        //TODO 后续替换成标准年份判断格式
                        if (isZCFZ_NB(text)) {
                            year = extractZCFZ_NB(text);
                            extractBizModel.addTable2(year);
                            logger.info("抽取{}章营业收入业务模型，分析财报年份：{}。", getChapterModel().getChapterId(), year);
                        } else if (isZCFZ_JB(text)) {
                            year = extractZCFZ_JB(text);
                            extractBizModel.addTable2(year);
                            logger.info("抽取{}章营业收入业务模型，分析财报年份：{}。", getChapterModel().getChapterId(), year);
                        } else {
                            logger.info("抽取{}章营业收入业务模型，未知数据：{}。", getChapterModel().getChapterId(), text);
                        }
                        if (!StringUtils.isEmpty(year) && years.size() < 4) {
                            years.add(year);
                        }
                    }
                    logger.info("抽取{}章营业收入业务模型，财务报表年份列表：{}。", getChapterModel().getChapterId(), years);
                }
                for (int j = 0; j < pageTableDataList.size(); j++) {
                    String tableData = pageTableDataList.get(j);
                    logger.info("抽取{}章营业收入业务模型，第{}页，数据：{}。", getChapterModel().getChapterId(), startTextLayout.getPageNumber(), tableData);
                    JsonArray pageData = str2Json(tableData).getAsJsonArray();
                    JsonObject var1 = pageData.get(0).getAsJsonObject();
                    JsonArray var2 = var1.get("data").getAsJsonArray();
                    clearEmptyCell(var2, years.size() * 2 + 1, 2);
                    for (int l = 2; l < var2.size(); l++) {
                        for (int k = 0; k < years.size(); k++) {
                            try {
                                JsonArray var3 = var2.get(l).getAsJsonArray();
                                JsonElement textElement = var3.get(0).getAsJsonObject();
                                JsonElement yysrElement = var3.get(k * 2 + 1).getAsJsonObject();
                                JsonElement zbElement = var3.get(k * 2 + 2).getAsJsonObject();
                                String itemName = ((JsonObject) textElement).get("text").getAsString();
                                logger.info("抽取{}章营业收入业务模型，解析营业收入表指标，指标名称：{}，数据内容：{}。", getChapterModel().getChapterId(), itemName, var3.toString());
                                ExtractItem ywbkExtractItem = (ExtractItem) BeanUtils.cloneBean(ywbk);
                                ExtractItem yysrExtractItem = (ExtractItem) BeanUtils.cloneBean(yysr);
                                ExtractItem zbExtractItem = (ExtractItem) BeanUtils.cloneBean(zb);
//                                setKV(ywbkExtractItem, textElement, textElement);
                                setZYYW_Table_KV(textElement, textElement, ywbkExtractItem, getAssignPageModel(pageArea.getPageNumber()));
                                setKV(yysrExtractItem, yysrElement, yysrElement);
                                setKV(zbExtractItem, zbElement, zbElement);
                                ywbkExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                yysrExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                zbExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                Map<String, ExtractItem> items = new HashMap<>();
                                items.put(ywbkExtractItem.getItemName(), ywbkExtractItem);
                                items.put(yysrExtractItem.getItemName(), yysrExtractItem);
                                items.put(zbExtractItem.getItemName(), zbExtractItem);
                                extractBizModel.addTableExtractItem2(years.get(k), items);
                            } catch (IllegalAccessException e) {
                                logger.error(e.getMessage(), e);
                            } catch (InstantiationException e) {
                                logger.error(e.getMessage(), e);
                            } catch (InvocationTargetException e) {
                                logger.error(e.getMessage(), e);
                            } catch (NoSuchMethodException e) {
                                logger.error(e.getMessage(), e);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
        logger.info("抽取{}章营业收入业务模型，营业收入信息表数据结构：{}。", getChapterModel().getChapterId(), obj2Json(extractBizModel));
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章营业收入业务模型，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }

    /**
     * 营业成本
     */
    private void extractM5Yycb() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取：{}章营业成本业务模型......", getChapterModel().getChapterId());
        List<PageModel> pageModelList = getPageModelList();
        PageModel pageModel = null;
        List<PageArea> pageAreaList = new ArrayList<>();
        TextLayout startTextLayout = null;
        TextLayout endTextLayout = null;
        ExtractBizModel extractBizModel = getChapterModel().getExtractBizModelMap().get("YYCB");
        for (int i = 0; i < pageModelList.size(); i++) {
            pageModel = pageModelList.get(i);
            if (pageModel == null) {
                continue;
            }
            JsonArray itemArray = getPageDataArray(pageModel);
            for (int j = 0; j < itemArray.size(); j++) {
                JsonArray items = itemArray.get(j).getAsJsonArray();
                String combineLine = combineTextJsonArray(items);
                if (isEmpty(combineLine)) {
                    continue;
                }
                if (j == (itemArray.size() - 1)) {
                    if (getPageModelBottomPageNum(items) > 0) {
                        logger.info("抽取：{}章营业成本业务模型，当前页码：{}，已到该页末尾，到下一页定位营业成本信息表结束位置。", getChapterModel().getChapterId(), pageModel.getPageNumber());
                        break;
                    }
                }
                if (isYYCB(combineLine)) {
                    setTableNameTextLayout(pageModel, extractBizModel, items);
                    logger.info("抽取：{}章营业成本业务模型，开始页码：{}，分析定位营业成本表格位置......，表头：{}。", getChapterModel().getChapterId(), combineLine);
                    startTextLayout = createKVTextLayout(pageModel, items);
                    continue;
                }
                if (isInner3(items, pageModel)) {
                    continue;
                } else if (startTextLayout != null) {
                    if (isAmtUnit(combineLine)) {
                        setTableUnitType(extractBizModel, combineLine);
                        continue;
                    }
                    endTextLayout = createKVTextLayout(pageModel, items);
                    logger.info("抽取：{}章营业成本业务模型，分析定位到营业收入表格结束位置，结束页码：{}。", getChapterModel().getChapterId(), combineLine);
                    pageAreaList.addAll(createPageArea(startTextLayout, endTextLayout));
                    break;
//                    startTextLayout = null;
//                    endTextLayout = null;
//                    continue;
                }
            }
            if (startTextLayout != null && endTextLayout != null) {
                break;
            }
        }
        if (CollectionUtils.isEmpty(pageAreaList)) {
            logger.info("抽取：{}章营业成本业务模型，分析定位营业成本表格位置失败。", getChapterModel().getChapterId());
            return;
        }
        logger.info("抽取：{}章营业成本业务模型，营业成本表格位置定位完成，开始抽取模型数据......", getChapterModel().getChapterId());
        //业务板块
        ExtractItem ywbk = extractBizModel.getExtractItem("YWBK");
        //营业收入、金额
        ExtractItem yycb = extractBizModel.getExtractItem("YYCB");
        //占比
        ExtractItem zb = extractBizModel.getExtractItem("ZB");
        List<String> years = new ArrayList<>();
        for (int i = 0; i < pageAreaList.size(); i++) {
            try {
                PageArea pageArea = pageAreaList.get(i);
                logger.info("抽取{}章营业成本业务模型，当前页码：{}，坐标：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageArea.getLayout());
                List<String> pageTableDataList = extractPdfByTable(new String[]{getDocumentModel().getPdfFilePath(), "-l", "-p", String.valueOf(pageArea.getPageNumber()), "-a", pageArea.getLayout(), "-f", "JSON"});
                logger.info("抽取{}章营业成本业务模型，当前页码：{}，表格数量：{}，表格数据：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageTableDataList.size(), pageTableDataList);
                if (pageTableDataList.isEmpty()) {
                    continue;
                }
                String tableHeader = pageTableDataList.get(0);
                logger.info("抽取{}章营业成本业务模型，营业成本表表头信息：{}。", getChapterModel().getChapterId(), tableHeader);
                if (i <= 1) {
                    JsonArray pageData = str2Json(tableHeader).getAsJsonArray();
                    JsonObject tableData = pageData.get(0).getAsJsonObject();
                    JsonArray items = tableData.get("data").getAsJsonArray();
                    JsonArray itemArray = items.get(0).getAsJsonArray();
                    for (int j = 0; j < itemArray.size(); j++) {
                        JsonObject cell = itemArray.get(j).getAsJsonObject();
                        String text = cell.get("text").getAsString();
                        String year = null;
                        if (StringUtils.isEmpty(text)) {
                            continue;
                        }
                        //TODO 后续替换成标准年份判断格式
                        if (isZCFZ_NB(text)) {
                            year = extractZCFZ_NB(text);
                            extractBizModel.addTable2(year);
                            logger.info("抽取{}章营业成本业务模型，分析财报年份：{}。", getChapterModel().getChapterId(), year);
                        } else if (isZCFZ_JB(text)) {
                            year = extractZCFZ_JB(text);
                            extractBizModel.addTable2(year);
                            logger.info("抽取{}章营业成本业务模型，分析财报年份：{}。", getChapterModel().getChapterId(), year);
                        } else {
                            logger.info("抽取{}章营业成本业务模型，未知数据：{}。", getChapterModel().getChapterId(), text);
                        }
                        if (!StringUtils.isEmpty(year) && years.size() < 4) {
                            years.add(year);
                        }
                    }
                    logger.info("抽取{}章营业成本业务模型，财务报表年份列表：{}。", getChapterModel().getChapterId(), years);
                }
                for (int j = 0; j < pageTableDataList.size(); j++) {
                    String tableData = pageTableDataList.get(j);
                    logger.info("抽取{}章营业成本业务模型，第{}页，数据：{}。", getChapterModel().getChapterId(), startTextLayout.getPageNumber(), tableData);
                    JsonArray pageData = str2Json(tableData).getAsJsonArray();
                    JsonObject var1 = pageData.get(0).getAsJsonObject();
                    JsonArray var2 = var1.get("data").getAsJsonArray();
                    clearEmptyCell(var2, years.size() * 2 + 1, 2);
                    for (int l = 2; l < var2.size(); l++) {
                        for (int k = 0; k < years.size(); k++) {
                            try {
                                JsonArray var3 = var2.get(l).getAsJsonArray();
                                JsonElement textElement = var3.get(0).getAsJsonObject();
                                JsonElement yysrElement = var3.get(k * 2 + 1).getAsJsonObject();
                                JsonElement zbElement = var3.get(k * 2 + 2).getAsJsonObject();
                                String itemName = ((JsonObject) textElement).get("text").getAsString();
                                logger.info("抽取{}章营业成本业务模型，解析营业成本表指标，指标名称：{}，数据内容：{}。", getChapterModel().getChapterId(), itemName, var3.toString());
                                ExtractItem ywbkExtractItem = (ExtractItem) BeanUtils.cloneBean(ywbk);
                                ExtractItem yycbExtractItem = (ExtractItem) BeanUtils.cloneBean(yycb);
                                ExtractItem zbExtractItem = (ExtractItem) BeanUtils.cloneBean(zb);
//                                setKV(ywbkExtractItem, textElement, textElement);
                                setZYYW_Table_KV(textElement, textElement, ywbkExtractItem, getAssignPageModel(pageArea.getPageNumber()));
                                setKV(yycbExtractItem, yysrElement, yysrElement);
                                setKV(zbExtractItem, zbElement, zbElement);
                                ywbkExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                yycbExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                zbExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                Map<String, ExtractItem> items = new HashMap<>();
                                items.put(ywbkExtractItem.getItemName(), ywbkExtractItem);
                                items.put(yycbExtractItem.getItemName(), yycbExtractItem);
                                items.put(zbExtractItem.getItemName(), zbExtractItem);
                                extractBizModel.addTableExtractItem2(years.get(k), items);
                            } catch (IllegalAccessException e) {
                                logger.error(e.getMessage(), e);
                            } catch (InstantiationException e) {
                                logger.error(e.getMessage(), e);
                            } catch (InvocationTargetException e) {
                                logger.error(e.getMessage(), e);
                            } catch (NoSuchMethodException e) {
                                logger.error(e.getMessage(), e);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
        logger.info("抽取{}章营业成本业务模型，营业成本信息表数据结构：{}。", getChapterModel().getChapterId(), obj2Json(extractBizModel));
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章营业成本业务模型，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }

    /**
     * 毛利润
     */
    private void extractM5Mlr() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取：{}章毛利润业务模型......", getChapterModel().getChapterId());
        List<PageModel> pageModelList = getPageModelList();
        PageModel pageModel = null;
        List<PageArea> pageAreaList = new ArrayList<>();
        TextLayout startTextLayout = null;
        TextLayout endTextLayout = null;
        ExtractBizModel extractBizModel = getChapterModel().getExtractBizModelMap().get("MLR");
        for (int i = 0; i < pageModelList.size(); i++) {
            pageModel = pageModelList.get(i);
            if (pageModel == null) {
                continue;
            }
            JsonArray itemArray = getPageDataArray(pageModel);
            for (int j = 0; j < itemArray.size(); j++) {
                JsonArray items = itemArray.get(j).getAsJsonArray();
                String combineLine = combineTextJsonArray(items);
                if (isEmpty(combineLine)) {
                    continue;
                }
                if (j == (itemArray.size() - 1)) {
                    if (getPageModelBottomPageNum(items) > 0) {
                        logger.info("抽取：{}章毛利润业务模型，当前页码：{}，已到该页末尾，到下一页定位毛利润信息表结束位置。", getChapterModel().getChapterId(), pageModel.getPageNumber());
                        break;
                    }
                }
                if (isMLR(combineLine)) {
                    setTableNameTextLayout(pageModel, extractBizModel, items);
                    logger.info("抽取：{}章毛利润业务模型，开始页码：{}，分析定位毛利润表格位置，表头：{}。", getChapterModel().getChapterId(), combineLine);
                    startTextLayout = createKVTextLayout(pageModel, items);
                    continue;
                }
                if (isInner3(items, pageModel)) {
                    continue;
                } else if (startTextLayout != null) {
                    if (isAmtUnit(combineLine)) {
                        setTableUnitType(extractBizModel, combineLine);
                        continue;
                    }
                    endTextLayout = createKVTextLayout(pageModel, items);
                    logger.info("抽取：{}章毛利润业务模型，分析定位到毛利润表格结束位置，结束页码：{}。", getChapterModel().getChapterId(), combineLine);
                    pageAreaList.addAll(createPageArea(startTextLayout, endTextLayout));
                    break;
//                    startTextLayout = null;
//                    endTextLayout = null;
//                    continue;
                }
            }
            if (startTextLayout != null && endTextLayout != null) {
                break;
            }
        }
        if (CollectionUtils.isEmpty(pageAreaList)) {
            logger.info("抽取：{}章毛利润业务模型，分析定位毛利润表格位置失败。", getChapterModel().getChapterId());
            return;
        }
        logger.info("抽取：{}章毛利润业务模型，毛利润业务模型表格位置定位完成，开始抽取模型数据......", getChapterModel().getChapterId());
        //业务板块
        ExtractItem ywbk = extractBizModel.getExtractItem("YWBK");
        //营业收入、金额
        ExtractItem mlr = extractBizModel.getExtractItem("MLR");
        //占比
        ExtractItem zb = extractBizModel.getExtractItem("ZB");
        List<String> years = new ArrayList<>();
        for (int i = 0; i < pageAreaList.size(); i++) {
            try {
                PageArea pageArea = pageAreaList.get(i);
                logger.info("抽取{}章毛利润业务模型，当前页码：{}，表格区域：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageArea.getLayout());
                List<String> pageTableDataList = extractPdfByTable(new String[]{getDocumentModel().getPdfFilePath(), "-l", "-p", String.valueOf(pageArea.getPageNumber()), "-a", pageArea.getLayout(), "-f", "JSON"});
                logger.info("抽取{}章毛利润业务模型，当前页码：{}，表格数量：{}，表格数据：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageTableDataList.size(), pageTableDataList);
                if (pageTableDataList.isEmpty()) {
                    continue;
                }
                String tableHeader = pageTableDataList.get(0);
                logger.info("抽取{}章毛利润业务模型，毛利润表表头信息：{}。", getChapterModel().getChapterId(), tableHeader);
                if (i <= 1) {
                    JsonArray pageData = str2Json(tableHeader).getAsJsonArray();
                    JsonObject tableData = pageData.get(0).getAsJsonObject();
                    JsonArray items = tableData.get("data").getAsJsonArray();
                    JsonArray itemArray = items.get(0).getAsJsonArray();
                    for (int j = 0; j < itemArray.size(); j++) {
                        JsonObject cell = itemArray.get(j).getAsJsonObject();
                        String text = cell.get("text").getAsString();
                        String year = null;
                        if (StringUtils.isEmpty(text)) {
                            continue;
                        }
                        //TODO 后续替换成标准年份判断格式
                        if (isZCFZ_NB(text)) {
                            year = extractZCFZ_NB(text);
                            extractBizModel.addTable2(year);
                            logger.info("抽取{}章毛利润业务模型，分析财报年份：{}。", getChapterModel().getChapterId(), year);
                        } else if (isZCFZ_JB(text)) {
                            year = extractZCFZ_JB(text);
                            extractBizModel.addTable2(year);
                            logger.info("抽取{}章毛利润业务模型，分析财报年份：{}。", getChapterModel().getChapterId(), year);
                        } else {
                            logger.info("抽取{}章毛利润业务模型，未知数据：{}。", getChapterModel().getChapterId(), text);
                        }
                        if (!StringUtils.isEmpty(year) && years.size() < 4) {
                            years.add(year);
                        }
                    }
                    logger.info("抽取{}章毛利润业务模型，财务报表年份列表：{}。", getChapterModel().getChapterId(), years);
                }
                for (int j = 0; j < pageTableDataList.size(); j++) {
                    String tableData = pageTableDataList.get(j);
                    logger.info("抽取{}章毛利润业务模型，第{}页，数据：{}。", getChapterModel().getChapterId(), startTextLayout.getPageNumber(), tableData);
                    JsonArray pageData = str2Json(tableData).getAsJsonArray();
                    JsonObject var1 = pageData.get(0).getAsJsonObject();
                    JsonArray var2 = var1.get("data").getAsJsonArray();
                    clearEmptyCell(var2, years.size() * 2 + 1, 2);
                    for (int l = 2; l < var2.size(); l++) {
                        for (int k = 0; k < years.size(); k++) {
                            try {
                                JsonArray var3 = var2.get(l).getAsJsonArray();
                                JsonElement textElement = var3.get(0).getAsJsonObject();
                                JsonElement yysrElement = var3.get(k * 2 + 1).getAsJsonObject();
                                JsonElement zbElement = var3.get(k * 2 + 2).getAsJsonObject();
                                String itemName = ((JsonObject) textElement).get("text").getAsString();
                                logger.info("抽取{}章毛利润业务模型，指标名称：{}，数据内容：{}。", getChapterModel().getChapterId(), itemName, var3.toString());
                                ExtractItem ywbkExtractItem = (ExtractItem) BeanUtils.cloneBean(ywbk);
                                ExtractItem mlrExtractItem = (ExtractItem) BeanUtils.cloneBean(mlr);
                                ExtractItem zbExtractItem = (ExtractItem) BeanUtils.cloneBean(zb);
//                                setKV(ywbkExtractItem, textElement, textElement);
                                setZYYW_Table_KV(textElement, textElement, ywbkExtractItem, getAssignPageModel(pageArea.getPageNumber()));
                                setKV(mlrExtractItem, yysrElement, yysrElement);
                                setKV(zbExtractItem, zbElement, zbElement);
                                ywbkExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                mlrExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                zbExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                Map<String, ExtractItem> items = new HashMap<>();
                                items.put(ywbkExtractItem.getItemName(), ywbkExtractItem);
                                items.put(mlrExtractItem.getItemName(), mlrExtractItem);
                                items.put(zbExtractItem.getItemName(), zbExtractItem);
                                extractBizModel.addTableExtractItem2(years.get(k), items);
                            } catch (IllegalAccessException e) {
                                logger.error(e.getMessage(), e);
                            } catch (InstantiationException e) {
                                logger.error(e.getMessage(), e);
                            } catch (InvocationTargetException e) {
                                logger.error(e.getMessage(), e);
                            } catch (NoSuchMethodException e) {
                                logger.error(e.getMessage(), e);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
        logger.info("抽取{}章毛利润业务模型，信息表数据结构：{}。", getChapterModel().getChapterId(), obj2Json(extractBizModel));
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章毛利润业务模型，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }


    /**
     * 毛利率
     */
    private void extractM5Mll() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取：{}章毛利率业务模型......", getChapterModel().getChapterId());
        List<PageModel> pageModelList = getPageModelList();
        PageModel pageModel = null;
        List<PageArea> pageAreaList = new ArrayList<>();
        TextLayout startTextLayout = null;
        TextLayout endTextLayout = null;
        ExtractBizModel extractBizModel = getChapterModel().getExtractBizModelMap().get("MLL");
        for (int i = 0; i < pageModelList.size(); i++) {
            pageModel = pageModelList.get(i);
            if (pageModel == null) {
                continue;
            }
            JsonArray itemArray = getPageDataArray(pageModel);
            for (int j = 0; j < itemArray.size(); j++) {
                JsonArray items = itemArray.get(j).getAsJsonArray();
                String combineLine = combineTextJsonArray(items);
                if (isEmpty(combineLine)) {
                    continue;
                }
                if (j == (itemArray.size() - 1)) {
                    if (getPageModelBottomPageNum(items) > 0) {
                        logger.info("抽取：{}章毛利率业务模型，当前页码：{}，毛利率信息表跳页，到下一页定位毛利率信息表结束位置。", getChapterModel().getChapterId(), pageModel.getPageNumber());
                        break;
                    }
                }
                if (isMLL(combineLine)) {
                    setTableNameTextLayout(pageModel, extractBizModel, items);
                    logger.info("抽取：{}章毛利率业务模型，开始页码：{}，分析定位毛利率表格位置，表头：{}。", getChapterModel().getChapterId(), combineLine);
                    startTextLayout = createKVTextLayout(pageModel, items);
                    continue;
                }
                if (isInner3(items, pageModel)) {
                    continue;
                } else if (startTextLayout != null) {
                    if (isAmtUnit(combineLine)) {
                        setTableUnitType(extractBizModel, combineLine);
                        continue;
                    }
                    endTextLayout = createKVTextLayout(pageModel, items);
                    logger.info("抽取：{}章毛利率业务模型，分析定位到毛利率表格结束位置，结束页码：{}。", getChapterModel().getChapterId(), combineLine);
                    pageAreaList.addAll(createPageArea(startTextLayout, endTextLayout));
                    break;
//                    startTextLayout = null;
//                    endTextLayout = null;
//                    continue;
                }
            }
            if (startTextLayout != null && endTextLayout != null) {
                break;
            }
        }
        if (CollectionUtils.isEmpty(pageAreaList)) {
            logger.info("抽取：{}章毛利率业务模型，分析定位毛利率表格位置失败。", getChapterModel().getChapterId());
            return;
        }
        logger.info("抽取：{}章毛利率业务模型，毛利率业务模型表格位置定位完成，开始抽取模型数据......", getChapterModel().getChapterId());

        //业务板块
        ExtractItem ywbk = extractBizModel.getExtractItem("YWBK");
        //占比
        ExtractItem zb = extractBizModel.getExtractItem("ZB");
        List<String> years = new ArrayList<>();
        for (int i = 0; i < pageAreaList.size(); i++) {
            try {
                PageArea pageArea = pageAreaList.get(i);
                logger.info("抽取{}章毛利率业务模型，当前页码：{}，表格位置：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageArea.getLayout());
                List<String> pageTableDataList = extractPdfByTable(new String[]{getDocumentModel().getPdfFilePath(), "-l", "-p", String.valueOf(pageArea.getPageNumber()), "-a", pageArea.getLayout(), "-f", "JSON"});
                logger.info("抽取{}章毛利率业务模型，当前页码：{}，表格数量：{}，表格数据：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageTableDataList.size(), pageTableDataList);
                if (pageTableDataList.isEmpty()) {
                    continue;
                }
                String tableHeader = pageTableDataList.get(0);
                logger.info("抽取{}章毛利率业务模型，毛利率表表头信息：{}。", getChapterModel().getChapterId(), tableHeader);
                if (i <= 1) {
                    JsonArray pageData = str2Json(tableHeader).getAsJsonArray();
                    JsonObject tableData = pageData.get(0).getAsJsonObject();
                    JsonArray items = tableData.get("data").getAsJsonArray();
                    for (int k = 0; k < items.size(); k++) {
                        JsonArray itemArray = items.get(k).getAsJsonArray();
                        if (k > 1) {
                            break;
                        }
                        for (int j = 0; j < itemArray.size(); j++) {
                            JsonObject cell = itemArray.get(j).getAsJsonObject();
                            String text = cell.get("text").getAsString();
                            String year = null;
                            if (StringUtils.isEmpty(text)) {
                                continue;
                            }
                            //TODO 后续替换成标准年份判断格式
                            if (isZCFZ_NB(text)) {
                                year = extractZCFZ_NB(text);
                                extractBizModel.addTable2(year);
                                logger.info("抽取{}章毛利率业务模型，分析财报年份：{}。", getChapterModel().getChapterId(), year);
                            } else if (isZCFZ_JB(text)) {
                                year = extractZCFZ_JB(text);
                                extractBizModel.addTable2(year);
                                logger.info("抽取{}章毛利率业务模型，分析财报年份：{}。", getChapterModel().getChapterId(), year);
                            } else {
                                logger.info("抽取{}章毛利率业务模型，未知数据：{}。", getChapterModel().getChapterId(), text);
                            }
                            if (!StringUtils.isEmpty(year) && years.size() < 4) {
                                years.add(year);
                            }
                        }
                    }
                    logger.info("抽取{}章毛利率业务模型，财务报表年份列表：{}。", getChapterModel().getChapterId(), years);
                }
                if (years.isEmpty()) {
                    continue;
                }
                for (int j = 0; j < pageTableDataList.size(); j++) {
                    String tableData = pageTableDataList.get(j);
                    logger.info("抽取{}章毛利率业务模型，第{}页，数据：{}。", getChapterModel().getChapterId(), startTextLayout.getPageNumber(), tableData);
                    JsonArray pageData = str2Json(tableData).getAsJsonArray();
                    JsonObject var1 = pageData.get(0).getAsJsonObject();
                    JsonArray var2 = var1.get("data").getAsJsonArray();
                    clearEmptyCell(var2, years.size() + 1, 1);
                    for (int l = 1; l < var2.size(); l++) {
                        for (int k = 0; k < years.size(); k++) {
                            try {
                                JsonArray var3 = var2.get(l).getAsJsonArray();
                                JsonElement textElement = var3.get(0).getAsJsonObject();
                                JsonElement zbElement = var3.get(k + 1).getAsJsonObject();
                                String itemName = ((JsonObject) textElement).get("text").getAsString();
                                logger.info("抽取{}章毛利率业务模型，指标名称：{}，数据内容：{}。", getChapterModel().getChapterId(), itemName, var3.toString());
                                ExtractItem ywbkExtractItem = (ExtractItem) BeanUtils.cloneBean(ywbk);
                                ExtractItem zbExtractItem = (ExtractItem) BeanUtils.cloneBean(zb);
//                                setKV(ywbkExtractItem, textElement, textElement);
                                setZYYW_Table_KV(textElement, textElement, ywbkExtractItem, getAssignPageModel(pageArea.getPageNumber()));
                                setKV(zbExtractItem, zbElement, zbElement);
                                ywbkExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                zbExtractItem.getValue().setPageNumber(pageArea.getPageNumber());
                                Map<String, ExtractItem> items = new HashMap<>();
                                items.put(ywbkExtractItem.getItemName(), ywbkExtractItem);
                                items.put(zbExtractItem.getItemName(), zbExtractItem);
                                extractBizModel.addTableExtractItem2(years.get(k), items);
                            } catch (IllegalAccessException e) {
                                logger.error(e.getMessage(), e);
                            } catch (InstantiationException e) {
                                logger.error(e.getMessage(), e);
                            } catch (InvocationTargetException e) {
                                logger.error(e.getMessage(), e);
                            } catch (NoSuchMethodException e) {
                                logger.error(e.getMessage(), e);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
        logger.info("抽取{}章毛利率业务模型，信息表数据结构：{}。", getChapterModel().getChapterId(), obj2Json(extractBizModel));
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章毛利率业务模型，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }

    /**
     * 营业收入
     */
    private void extractM5Zjgc() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取：{}章在建工程业务模型数据......", getChapterModel().getChapterId());
        List<PageModel> pageModelList = getPageModelList();
        PageModel pageModel = null;
        List<PageArea> pageAreaList = new ArrayList<>();
        TextLayout startTextLayout = null;
        TextLayout endTextLayout = null;
        ExtractBizModel extractBizModel = getChapterModel().getExtractBizModelMap().get("ZJGC");
        for (int i = 0; i < pageModelList.size(); i++) {
            pageModel = pageModelList.get(i);
            if (pageModel == null) {
                continue;
            }
            JsonArray itemArray = getPageDataArray(pageModel);
            for (int j = 0; j < itemArray.size(); j++) {
                JsonArray items = itemArray.get(j).getAsJsonArray();
                String combineLine = combineTextJsonArray(items);
                if (isEmpty(combineLine)) {
                    continue;
                }
                if (j == (itemArray.size() - 1)) {
                    if (getPageModelBottomPageNum(items) > 0) {
                        logger.info("抽取：{}章在建工程业务模型数据，当前页码：{}，在建工程信息表跳页，到下一页定位在建工程信息表结束位置。", getChapterModel().getChapterId(), pageModel.getPageNumber());
                        break;
                    }
                }
                if (isZJXM(combineLine)) {
                    if (startTextLayout != null) {
                        endTextLayout = createKVTextLayout(pageModel, items);
                        logger.info("抽取：{}章在建工程业务模型数据，分析定位到在建工程表格结束位置，结束页码：{}。", getChapterModel().getChapterId(), combineLine);
                        pageAreaList.addAll(createPageArea(startTextLayout, endTextLayout));
                        startTextLayout = null;
                        endTextLayout = null;
                    }
                    logger.info("抽取：{}章在建工程业务模型数据，开始页码：{}，分析定位到在建工程表格位置，表头：{}。", getChapterModel().getChapterId(), combineLine);
                    setTableNameTextLayout(pageModel,extractBizModel,items);
                    startTextLayout = createKVTextLayout(pageModel, items);
                    continue;
                }
                if (isInner3(items, pageModel)) {
                    continue;
                } else if (startTextLayout != null) {
                    if (isZJXM_UNIT(combineLine)) {
                        continue;
                    }
                    endTextLayout = createKVTextLayout(pageModel, items);
                    logger.info("抽取：{}章在建工程业务模型数据，分析定位到在建工程表格结束位置，结束页码：{}。", getChapterModel().getChapterId(), combineLine);
                    pageAreaList.addAll(createPageArea(startTextLayout, endTextLayout));
                    startTextLayout = null;
                    endTextLayout = null;
                    if (isZJXM(combineLine)) {
                        startTextLayout = createKVTextLayout(pageModel, items.get(0).getAsJsonObject());
                    }
                    continue;
                }
            }
        }
        if (CollectionUtils.isEmpty(pageAreaList)) {
            logger.info("抽取：{}章在建工程业务模型数据，分析定位在建工程表格位置失败。", getChapterModel().getChapterId());
            return;
        }
        logger.info("抽取：{}章在建工程业务模型数据，在建工程表格位置定位完成，开始抽取模型数据......", getChapterModel().getChapterId());
        zjgcTokenizer.loadCoreSynonyms(extractBizModel);
        for (int i = 0; i < pageAreaList.size(); i++) {
            try {
                PageArea pageArea = pageAreaList.get(i);
                logger.info("抽取{}章在建工程业务模型数据，当前页码：{}，表格区域：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageArea.getLayout());
                List<String> pageTableDataList = extractPdfByTable(new String[]{getDocumentModel().getPdfFilePath(), "-l", "-p", String.valueOf(pageArea.getPageNumber()), "-a", pageArea.getLayout(), "-f", "JSON"});
                logger.info("抽取{}章在建工程业务模型数据，当前页码：{}，表格数量：{}，表格数据：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageTableDataList.size(), pageTableDataList);
                if (pageTableDataList.isEmpty()) {
                    continue;
                }
                String tableHeader = pageTableDataList.get(0);
                List<ZJGCIndex> zjgcIndexList = new ArrayList<>();
                logger.info("抽取{}章在建工程业务模型数据，表头信息：{}。", getChapterModel().getChapterId(), tableHeader);
                {
                    JsonArray pageData = str2Json(tableHeader).getAsJsonArray();
                    JsonObject tableData = pageData.get(0).getAsJsonObject();
                    JsonArray items = tableData.get("data").getAsJsonArray();
                    JsonArray itemArray = items.get(0).getAsJsonArray();
                    for (int j = 0; j < itemArray.size(); j++) {
                        JsonObject cell = itemArray.get(j).getAsJsonObject();
                        String text = cell.get("text").getAsString().trim();
                        if (isEmpty(text)) {
                            continue;
                        }
                        text = replaceCRLF(text);
                        //TODO 先这么着吧，后面再改吧！！！
                        ExtractItem extractItem = zjgcTokenizer.splitWords(extractBizModel, text);
                        if (extractItem != null) {
                            zjgcIndexList.add(new ZJGCIndex(extractItem.getItemName(), Integer.valueOf(j)));
                        }
                    }
                }
                for (int j = 0; j < pageTableDataList.size(); j++) {
                    String tableData = pageTableDataList.get(j);
                    logger.info("抽取{}章在建工程业务模型数据，表格数据：{}。", getChapterModel().getChapterId(), tableData);
                    JsonArray pageData = str2Json(tableData).getAsJsonArray();
                    JsonObject var1 = pageData.get(0).getAsJsonObject();
                    JsonArray var2 = var1.get("data").getAsJsonArray();
                    for (int l = 0; l < var2.size(); l++) {
                        if (l < 1) {
                            continue;
                        }
                        JsonArray var3 = var2.get(l).getAsJsonArray();
                        try {
                            Map<String, ExtractItem> items = new HashMap<>();
                            for (int k = 0; k < zjgcIndexList.size(); k++) {
                                logger.info("抽取{}章在建工程业务模型数据，第{}页，第{}条数据，内容：{}。", getChapterModel().getChapterId(), i, j, var3.toString());
                                ZJGCIndex zjgcIndex = zjgcIndexList.get(k);
                                JsonElement jsonElement = var3.get(zjgcIndex.getIndex()).getAsJsonObject();
                                ExtractItem extractItem = extractBizModel.getExtractItem(zjgcIndex.getName());
                                ExtractItem newExtractItem = (ExtractItem) BeanUtils.cloneBean(extractItem);
                                setKV(newExtractItem, jsonElement, jsonElement);

                                if(newExtractItem.getKey()!=null){
                                    newExtractItem.getKey().getTextLayout().setPageNumber(pageArea.getPageNumber());
                                }

                                if(newExtractItem.getValue()!=null){
                                    newExtractItem.getValue().getTextLayout().setPageNumber(pageArea.getPageNumber());
                                }
                                items.put(newExtractItem.getItemName(), newExtractItem);
                                logger.info("抽取{}章在建工程业务模型数据，数据内容：{}。", getChapterModel().getChapterId(), var3.toString());
                            }
                            extractBizModel.addTable3(items);
                        } catch (IllegalAccessException e) {
                            logger.error(e.getMessage(), e);
                        } catch (InstantiationException e) {
                            logger.error(e.getMessage(), e);
                        } catch (InvocationTargetException e) {
                            logger.error(e.getMessage(), e);
                        } catch (NoSuchMethodException e) {
                            logger.error(e.getMessage(), e);
                        }
                    }
                }
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
        zjgcTokenizer.unloadCoreSynonyms(extractBizModel);
        logger.info("抽取{}章在建工程业务模型数据，数据结构：{}。", getChapterModel().getChapterId(), obj2Json(extractBizModel));
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章在建工程业务模型数据，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }

    /**
     * 营业收入
     */
    private void extractM5Ywggc() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取：{}章已完成工程业务模型数据......", getChapterModel().getChapterId());
        List<PageModel> pageModelList = getPageModelList();
        PageModel pageModel = null;
        List<PageArea> pageAreaList = new ArrayList<>();
        TextLayout startTextLayout = null;
        TextLayout endTextLayout = null;
        for (int i = 0; i < pageModelList.size(); i++) {
            pageModel = pageModelList.get(i);
            if (pageModel == null) {
                continue;
            }
            JsonArray itemArray = getPageDataArray(pageModel);
            for (int j = 0; j < itemArray.size(); j++) {
                JsonArray items = itemArray.get(j).getAsJsonArray();
                String combineLine = combineTextJsonArray(items);
                if (isEmpty(combineLine)) {
                    continue;
                }
                if (j == (itemArray.size() - 1)) {
                    if (getPageModelBottomPageNum(items) > 0) {
                        logger.info("抽取：{}章已完成工程业务模型数据，当前页码：{}，已完工工程信息表跳页，到下一页定位在建工程信息表结束位置。", getChapterModel().getChapterId(), pageModel.getPageNumber());
                        break;
                    }
                }
                if (isYWGGC(combineLine)) {
                    if (startTextLayout != null) {
                        endTextLayout = createKVTextLayout(pageModel, items);
                        logger.info("抽取：{}章已完成工程业务模型数据，分析定位到已完成工程表格结束位置，结束页码：{}。", getChapterModel().getChapterId(), combineLine);
                        pageAreaList.addAll(createPageArea(startTextLayout, endTextLayout));
                        startTextLayout = null;
                        endTextLayout = null;
                    }
                    logger.info("抽取：{}章已完成工程业务模型数据，开始页码：{}，分析定位到已完成表格位置，表头：{}。", getChapterModel().getChapterId(), combineLine);
                    startTextLayout = createKVTextLayout(pageModel, items);
                    setTableNameTextLayout(pageModel, getExtractBizModel("YWGXM"), items);
                    continue;
                }
                if (isInner3(items, pageModel)) {
                    continue;
                } else if (startTextLayout != null) {
                    if (isYWCGC_UNIT(combineLine)) {
                        continue;
                    }
                    endTextLayout = createKVTextLayout(pageModel, items);
                    logger.info("抽取：{}章已完成工程业务模型数据，分析定位到已完成工程表格结束位置，结束页码：{}。", getChapterModel().getChapterId(), combineLine);
                    pageAreaList.addAll(createPageArea(startTextLayout, endTextLayout));
                    startTextLayout = null;
                    endTextLayout = null;
                    if (isYWGGC(combineLine)) {
                        startTextLayout = createKVTextLayout(pageModel, items.get(0).getAsJsonObject());
                    }
                    continue;
                }
            }
        }
        if (CollectionUtils.isEmpty(pageAreaList)) {
            logger.info("抽取：{}章已完成工程业务模型数据，分析定位已完成工程表格位置失败。", getChapterModel().getChapterId());
            return;
        }
        logger.info("抽取：{}章已完成工程业务模型数据，已完成工程位置定位完成，开始抽取模型数据......", getChapterModel().getChapterId());
        ExtractBizModel extractBizModel = getChapterModel().getExtractBizModelMap().get("YWGXM");
        ywggcTokenizer.loadCoreSynonyms(extractBizModel);
        for (int i = 0; i < pageAreaList.size(); i++) {
            try {
                PageArea pageArea = pageAreaList.get(i);
                logger.info("抽取{}章已完成工程业务模型数据，当前页码：{}，表格区域：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageArea.getLayout());
                List<String> pageTableDataList = extractPdfByTable(new String[]{getDocumentModel().getPdfFilePath(), "-l", "-p", String.valueOf(pageArea.getPageNumber()), "-a", pageArea.getLayout(), "-f", "JSON"});
                logger.info("抽取{}章已完成工程业务模型数据，当前页码：{}，表格数量：{}，表格数据：{}。", getChapterModel().getChapterId(), pageArea.getPageNumber(), pageTableDataList.size(), pageTableDataList);
                if (pageTableDataList.isEmpty()) {
                    continue;
                }
                String tableHeader = pageTableDataList.get(0);
                logger.info("抽取{}章已完成工程业务模型数据，表头信息：{}。", getChapterModel().getChapterId(), tableHeader);
                JsonArray pageData = str2Json(tableHeader).getAsJsonArray();
                JsonObject tableData = pageData.get(0).getAsJsonObject();
                JsonArray items = tableData.get("data").getAsJsonArray();
                JsonArray itemArray = items.get(0).getAsJsonArray();
                ExtractItem extractItem = null;
                for (int j = 0; j < itemArray.size(); j++) {
                    JsonObject cell = itemArray.get(j).getAsJsonObject();
                    String text = replaceCRLF(cell.get("text").getAsString().trim());
                    if (isEmpty(text)) {
                        continue;
                    }
                    extractItem = ywggcTokenizer.splitWords(extractBizModel, text);
                    if (extractItem != null) {
                        KVText kText = new KVText();
                        kText.setText(text);
                        TextLayout textLayout = null;
                        try {
                            textLayout = findTextArea2(cell, getAssignPageModel(pageArea.getPageNumber()).getJsonTextData());
                        } catch (Exception e) {
                            logger.error(e.getMessage(), e);
                        }
                        if (textLayout == null) {
                            kText.add(createKVTextLayout(cell));
                        }
                        kText.add(textLayout);
                        kText.getTextLayout().setPageNumber(pageArea.getPageNumber());
                        kText.getTextLayout().setText(kText.getText());
                        extractItem.setKey(kText);
                    }
                }
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
        ywggcTokenizer.unloadCoreSynonyms(extractBizModel);
        logger.info("抽取{}章已完成工程业务模型数据，数据结构：{}。", getChapterModel().getChapterId(), obj2Json(extractBizModel));
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}章已完成工程业务模型数据，耗时：{}毫秒。", getChapterModel().getChapterId(), (t2 - t1));
    }

    private void extractIndustryIndicators() {
        long t1 = System.currentTimeMillis();
        IndustryType industryType = getDocumentModel().getIndustryType();
        logger.info("开始抽取{}行业特色指标......", industryType);
        if (industryType == null) {
            logger.warn("未指定行业类型，中断行业指标抽取流程！！！");
            return;
        }
        switch (industryType) {
            case HD:
                extractIndustry_HD();
                break;
            case FDC:
                extractIndustry_FDC();
                break;
            case MT:
                extractIndustry_MT();
                break;
            case SN:
                extractIndustry_SN();
                break;
            case GT:
                extractIndustry_GT();
                break;
            case GSGL:
                extractIndustry_GSGL();
                break;
            default:
                break;
        }
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}行业特色指标完成，耗时：{}毫秒。", industryType, (t2 - t1));
    }

    private void extractIndustry_MT() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取{}行业特色指标......", getDocumentModel().getIndustryType());
        extractIndustry_MT_MTCL();
        extractIndustry_MT_XSJG();
        extractIndustry_MT_SYKCCL();
        extractIndustry_MT_SCCB();
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}行业特色指标完成，耗时：{}毫秒。", getDocumentModel().getIndustryType(), (t2 - t1));
    }

    private void extractIndustry_FDC() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取{}行业特色指标......", getDocumentModel().getIndustryType());
        extractIndustry_FDC_QYXSMJ();
        extractIndustry_FDC_TDCBGHJZMJ();
        extractIndustry_FDC_DSMJZB();
        extractIndustry_FDC_XSJE();
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}行业特色指标完成，耗时：{}毫秒。", getDocumentModel().getIndustryType(), (t2 - t1));
    }

    /**
     * 水泥-产能利用率
     */
    private void extractIndustry_FDC_DSMJZB() {
        ExtractBizModel extractBizModel = getExtractBizModel("FDC");
        ExtractItem extractItem = extractBizModel.getExtractItem("DSMJZB");
        fdcTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                fdcTokenizer.extractFDC_DSMJZB(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        fdcTokenizer.unloadCoreSynonyms(extractItem);
    }

    private void extractIndustry_FDC_QYXSMJ() {
        ExtractBizModel extractBizModel = getExtractBizModel("FDC");
        ExtractItem extractItem = extractBizModel.getExtractItem("QYXSMJ");
        fdcTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                fdcTokenizer.extractFDC_QYXSMJ(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        fdcTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 水泥-产能利用率
     */
    private void extractIndustry_FDC_XSJE() {
        ExtractBizModel extractBizModel = getExtractBizModel("FDC");
        ExtractItem extractItem = extractBizModel.getExtractItem("XSJE");
        fdcTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                fdcTokenizer.extractFDC_XSJE(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        fdcTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 水泥-产能利用率
     */
    private void extractIndustry_FDC_TDCBGHJZMJ() {
        ExtractBizModel extractBizModel = getExtractBizModel("FDC");
        ExtractItem extractItem = extractBizModel.getExtractItem("GHJZMJ");
        fdcTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                fdcTokenizer.extractFDC_TDCBGHJZMJ(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        fdcTokenizer.unloadCoreSynonyms(extractItem);
    }

    private void extractIndustry_HD() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取{}行业特色指标......", getDocumentModel().getIndustryType());
        extractIndustry_HD_FDSBPJLYXSS();
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}行业特色指标完成，耗时：{}毫秒。", getDocumentModel().getIndustryType(), (t2 - t1));
    }

    private void extractIndustry_SN() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取{}行业特色指标......", getDocumentModel().getIndustryType());
        extractIndustry_SN_SLCN();
        extractIndustry_SN_CNLYL();
        extractIndustry_SN_XKGMJ();
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}行业特色指标完成，耗时：{}毫秒。", getDocumentModel().getIndustryType(), (t2 - t1));
    }

    private void extractIndustry_GT() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取{}行业特色指标......", getDocumentModel().getIndustryType());
        extractIndustry_GT_CNLYL();
        extractIndustry_GT_RJCGL();
        extractIndustry_GT_CLGM();
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}行业特色指标完成，耗时：{}毫秒。", getDocumentModel().getIndustryType(), (t2 - t1));
    }

    /**
     * 水泥-产能利用率
     */
    private void extractIndustry_SN_CNLYL() {
        ExtractBizModel extractBizModel = getExtractBizModel("SN");
        ExtractItem extractItem = extractBizModel.getExtractItem("CNLYL");
        snTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                snTokenizer.extractSN_CNLYL(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        snTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 水泥-新开工面积
     */
    private void extractIndustry_SN_XKGMJ() {
        ExtractBizModel extractBizModel = getExtractBizModel("SN");
        ExtractItem extractItem = extractBizModel.getExtractItem("XKGMJ");
        snTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                snTokenizer.extractSN_XKGMJ(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        snTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 水泥-熟料产能
     */
    private void extractIndustry_SN_SLCN() {
        ExtractBizModel extractBizModel = getExtractBizModel("SN");
        ExtractItem extractItem = extractBizModel.getExtractItem("SLCN");
        snTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                snTokenizer.extractgSN_SLCN(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        snTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 钢铁-产能利用率
     */
    private void extractIndustry_GT_CNLYL() {
        ExtractBizModel extractBizModel = getExtractBizModel("GT");
        ExtractItem extractItem = extractBizModel.getExtractItem("CNLYL");
        gtTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                gtTokenizer.extractGT_CNLYL(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        gtTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 钢铁-产能利用率
     */
    private void extractIndustry_GT_RJCGL() {
        ExtractBizModel extractBizModel = getExtractBizModel("GT");
        ExtractItem extractItem = extractBizModel.getExtractItem("CNLYL");
        gtTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                gtTokenizer.extractGT_RJCGL(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        gtTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 钢铁-产能利用率
     */
    private void extractIndustry_GT_CLGM() {
        PageModel pageModel = null;
        ExtractBizModel extractBizModel = getExtractBizModel("GT");
        ExtractItem extractItem = extractBizModel.getExtractItem("CNGM");
        gtTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                gtTokenizer.extractGT_CLGM(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        gtTokenizer.unloadCoreSynonyms(extractItem);
    }

    private void extractIndustry_GSGL() {
        long t1 = System.currentTimeMillis();
        logger.info("开始抽取{}行业特色指标......", getDocumentModel().getIndustryType());
        extractIndustry_GSGL_GLKYL();
        extractIndustry_GSGL_GLKYZZL();
        extractIndustry_GSGL_GLHYL();
        extractIndustry_GSGL_GLHYZZL();
        long t2 = System.currentTimeMillis();
        logger.info("抽取{}行业特色指标完成，耗时：{}毫秒。", getDocumentModel().getIndustryType(), (t2 - t1));
    }

    /**
     * 高速公路-公路客运量
     */
    private void extractIndustry_GSGL_GLKYL() {
        ExtractBizModel extractBizModel = getExtractBizModel("GSGL");
        ExtractItem extractItem = extractBizModel.getExtractItem("KYL");
        gsglTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                gsglTokenizer.extractGSGL_GLKYL(extractItem, childSectionModel,getFragmentPageModeList(childSectionModel.getStartPage(),childSectionModel.getEndPage()));
            }
        }
        gsglTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 高速公路-公路客运周转量
     */
    private void extractIndustry_GSGL_GLKYZZL() {
        ExtractBizModel extractBizModel = getExtractBizModel("GSGL");
        ExtractItem extractItem = extractBizModel.getExtractItem("KYZZL");
        gsglTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                gsglTokenizer.extractGSGL_GLKYZZL(extractItem, childSectionModel,getFragmentPageModeList(childSectionModel.getStartPage(),childSectionModel.getEndPage()));
            }
        }
        gsglTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 高速公路-公路货运量
     */
    private void extractIndustry_GSGL_GLHYL() {
        ExtractBizModel extractBizModel = getExtractBizModel("GSGL");
        ExtractItem extractItem = extractBizModel.getExtractItem("HYL");
        gsglTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                gsglTokenizer.extractGSGL_GLHYL(extractItem, childSectionModel,getFragmentPageModeList(childSectionModel.getStartPage(),childSectionModel.getEndPage()));
            }
        }
        gsglTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 高速公路-公路货运周转量
     */
    private void extractIndustry_GSGL_GLHYZZL() {
        ExtractBizModel extractBizModel = getExtractBizModel("GSGL");
        ExtractItem extractItem = extractBizModel.getExtractItem("HYZZL");
        gsglTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                gsglTokenizer.extractGSGL_GLHYZZL(extractItem, childSectionModel,getFragmentPageModeList(childSectionModel.getStartPage(),childSectionModel.getEndPage()));
            }
        }
        gsglTokenizer.unloadCoreSynonyms(extractItem);
    }


    /**
     * 火电-发电设备平均利用小时数
     */
    private void extractIndustry_HD_FDSBPJLYXSS() {
        ExtractBizModel extractBizModel = getExtractBizModel("HD");
        ExtractItem extractItem = extractBizModel.getExtractItem("FDXSS");
        hdTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                hdTokenizer.extractHD_FDSBLYXSS(extractItem, childSectionModel, getFragmentPageModeList(childSectionModel.getStartPage(), childSectionModel.getEndPage()));
            }
        }
        hdTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 煤炭-煤炭产量
     */
    private void extractIndustry_MT_MTCL() {
        ExtractBizModel extractBizModel = getExtractBizModel("MT");
        ExtractItem extractItem = extractBizModel.getExtractItem("SNDCL");//上年度产量
        mtTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                mtTokenizer.extractMT_MTCL2(extractItem, childSectionModel,getFragmentPageModeList(childSectionModel.getStartPage(),childSectionModel.getEndPage()));
            }
        }
        mtTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 煤炭-平均销售价格
     */
    private void extractIndustry_MT_XSJG() {
        ExtractBizModel extractBizModel = getExtractBizModel("MT");
        ExtractItem extractItem = extractBizModel.getExtractItem("SNDXSJG");//上年度销售价格
        mtTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                mtTokenizer.extractMT_XSJG2(extractItem, childSectionModel,getFragmentPageModeList(childSectionModel.getStartPage(),childSectionModel.getEndPage()));
            }
        }
        mtTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 煤炭-生产成本
     */
    private void extractIndustry_MT_SCCB() {
        ExtractBizModel extractBizModel = getExtractBizModel("MT");
        ExtractItem extractItem = extractBizModel.getExtractItem("SNDSCCB");//上年度生产成本
        mtTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                mtTokenizer.extractMT_SCCB2(extractItem, childSectionModel,getFragmentPageModeList(childSectionModel.getStartPage(),childSectionModel.getEndPage()));
            }
        }
        mtTokenizer.unloadCoreSynonyms(extractItem);
    }

    /**
     * 煤炭-剩余可采储量
     */
    private void extractIndustry_MT_SYKCCL() {
        ExtractBizModel extractBizModel = getExtractBizModel("MT");
        ExtractItem extractItem = extractBizModel.getExtractItem("SYKCCL");
        mtTokenizer.loadCoreSynonyms(extractItem);
        List<SectionModel> sectionModelList = getChapterModel().getSectionModelList();
        for (int i = 0; i < sectionModelList.size(); i++) {
            SectionModel sectionModel = sectionModelList.get(i);
            List<SectionModel> childSectionModelList = sectionModel.getChildSectionModelList();
            if (CollectionUtils.isEmpty(childSectionModelList)) {
                continue;
            }
            for (int j = 0; j < childSectionModelList.size(); j++) {
                SectionModel childSectionModel = childSectionModelList.get(j);
                if (childSectionModel == null) {
                    continue;
                }
                String content = childSectionModel.getContent();
                if (isEmpty(content)) {
                    continue;
                }
                logger.info("抽取{}章业务模型数据，指标名称：{}，分析文本：{}。", getChapterModel().getChapterId(), extractItem.getItemName(), childSectionModel.getTitle());
                mtTokenizer.extractMT_SYKCCL2(extractItem, childSectionModel,getFragmentPageModeList(childSectionModel.getStartPage(),childSectionModel.getEndPage()));
            }
        }
        mtTokenizer.unloadCoreSynonyms(extractItem);
    }
}

class DJGIndex {
    String name;
    int index;

    public DJGIndex(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}

class ZJGCIndex {
    String name;
    int index;

    public ZJGCIndex(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}